package com.example.gateway.config.RateLimiter;

import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import reactor.core.publisher.Mono;

@Configuration
public class RateLimiterConfig {

    @Bean
    public KeyResolver userKeyResolver() {
        //即按这里的东西作为key来分组，进行限流
        return exchange -> Mono.just(exchange.getRequest().getPath().toString());
    }
}
